import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import get from '@dfeidao/atom-web/local/get';
import set from '@dfeidao/atom-web/local/set';
import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';
import set_nodes_cls from '@dfeidao/atom-web/ui/set-nodes-cls';


export default async function a002(fd: IFeidaoAiBrowserComponent, args: { currentTarget: HTMLElement }) {
	const node = args.currentTarget.closest('[vlist]') as HTMLDivElement;
	const nodes = Array.from(fd.data.node.querySelectorAll('[vlist]')) as HTMLElement[];
	set_nodes_cls(nodes, 'bg-c', false);
	set_node_cls(node, 'bg-c', true);

	const fei = get(fd, 'fei') as object[];
	const arr = fei.map((v: { w: string }) => {
		return v.w;
	});
	// console.log(arr);
	const obj = JSON.parse(node.getAttribute('data-v'));
	set(fd, 'ss', obj[arr[0]]);
	set(fd, 'aa', obj[arr[1]]);
}

